<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<% //Grab the username and emp_id from the session
String emp_id=(String)session.getAttribute("emp_id");
int ei=Integer.parseInt(emp_id);
String ename=request.getParameter("ename");
String ephone=request.getParameter("ephone");
String egender=request.getParameter("egender");
String equalification=request.getParameter("equalification");
String modify=request.getParameter("modify");

%>
<% if(modify.equals("no")){%>
<table width="400" align="center">
    <tr bgcolor="#EEEEEE" height="20px">
        <th colspan="2" scope="col">Enter your new description here</th>
    </tr>
    <form method="post" class="searchform" action="edit_personal_info.jsp?modify=yes">
        <tr bgcolor="#FCFCFC">
            <td height="24">Phone</td>
            <td><input name="ephone" type="text" value="<%= ephone%>" size="25" maxlength="25" /></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td>Qualification</td>
            <td><input name="equalification" type="text" value="<%= equalification%>" size="25" maxlength="25" /</td>
                   </tr>
        <tr bgcolor="#FCFCFC">
            <td>Gender</td>
            <td><input name="egender" type="text" value="<%= egender%>" size="25" maxlength="25" /</td>
                   </tr>
        
        <tr >
            <td></td>
            <td>
                
                <p> <input type="submit" name="OK" class="button" value="Send Modification" /></p>
            </td>
        </tr>
    </form>
</table>
<% }else if(modify.equals("yes")){%>
Your personal information modified successfully
<%
String query="update employee set employee.gender='"+egender+"',employee.phone='"+ephone +"' where employee.emp_id='"+ei+"'";

Connection db_conn = null;
Statement statement = null;
PreparedStatement pstmt;
ResultSet rs;
try{
Class.forName("com.mysql.jdbc.Driver");
String url= "jdbc:mysql://localhost:3306/db";
db_conn = DriverManager.getConnection( url,"root", "root" );
statement = db_conn.createStatement();
statement.executeUpdate(query);
db_conn.close();
} catch(SQLException e){
e.printStackTrace();
out.println("sql not found");
out.println(e);
} catch(ClassNotFoundException e){
e.printStackTrace();
out.println(e);
}
%>
<% }%>